﻿using System;
using System.Configuration;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace TMS
{
    public partial class NewUser : Form
    {
        public NewUser()
        {
            InitializeComponent();
        }

        private void NewUser_Load(object sender, EventArgs e)
        {
           
        }

        private void AddButton_Click(object sender, EventArgs e)
        {
            string connString = ConfigurationManager.ConnectionStrings["MyDBConnectionString"].ConnectionString;

            MySqlConnection conn = null;
            conn = new MySqlConnection(connString);
            conn.Open();

            string stm = @"INSERT INTO Users VALUES (DEFAULT,'"+ImeText.Text+"','"+PrezimeText.Text+"','"+KorisnickoImeText.Text+"','"+LozinkaText.Text+"',"+Convert.ToInt32(LevelText.Text)+")";
            MySqlCommand cmd = new MySqlCommand(stm, conn);
            cmd.ExecuteNonQuery();
            this.Close();

        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        
    }
}
